package io.renren.modules.mybog.fromControoler;




import io.renren.modules.mybog.entity.CategoryEntity;
import io.renren.modules.mybog.fromControoler.utiles.R;
import io.renren.modules.mybog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小🌤
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/bolg/category")
public class CategoryControllers {
    @Autowired
    private CategoryService  categoryService;

    @GetMapping("/list")
    public io.renren.modules.mybog.fromControoler.utiles.R list(){
        List<CategoryEntity> list =categoryService.list();
        return R.ok().data("data",list);
    }

    @GetMapping("/info/{name}")
    public R info(@PathVariable("name")String name){
         CategoryEntity categoryEntity= categoryService.findByNmae(name);
         return R.ok().data("cate",categoryEntity);
    }

}

